package com.whcoding.test.constant;

/**
 * @program: spring-boot-learning
 * @description:
 * @author: whcoding
 * @create: 2022-07-26 15:49
 **/
public enum OperationEnum {

	INSERT(1,"新增", "Create"),

	DELETE(2, "删除", "Delete"),

	MODIFY(3, "修改", "Modify"),

	QUERY(4, "查询", "Query");

	/**
	 * 动作id
	 */
	private Integer operationId;

	/**
	 * 动作名称
	 */
	private String operationName;

	/**
	 * 对应类的中间名称
	 */
	private String simpleName;

	OperationEnum(Integer operationId, String operationName) {
		this.operationId = operationId;
		this.operationName = operationName;
	}
	OperationEnum(Integer operationId, String operationName,String simpleName) {
		this.operationId = operationId;
		this.operationName = operationName;
		this.simpleName = simpleName;
	}

	public static OperationEnum getByOperationId(Integer operationId) {
		OperationEnum[] values = OperationEnum.values();
		for (OperationEnum operationEnum : values) {
			if (operationEnum.getOperationId().equals(operationId)) {
				return operationEnum;
			}
		}
		return null;
	}


	public Integer getOperationId() {
		return operationId;
	}

	public void setOperationId(Integer operationId) {
		this.operationId = operationId;
	}

	public String getOperationName() {
		return operationName;
	}

	public void setOperationName(String operationName) {
		this.operationName = operationName;
	}

	public String getSimpleName() {
		return simpleName;
	}

	public void setSimpleName(String simpleName) {
		this.simpleName = simpleName;
	}
}
